package com.zhangshihao.employee.service;

import com.zhangshihao.employee.domain.Employee;
import com.zhangshihao.employee.mapper.EmployeeMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class EmployeeService {
    @Autowired
    private EmployeeMapper employeeMapper;

    public void register(Employee employee) {
        employeeMapper.insert(employee);
    }

    public List<Employee> listAll() {
        return employeeMapper.findAll();
    }

    public void update(Employee employee) {
        employeeMapper.update(employee);
    }

    public void delete(Integer id) {
        employeeMapper.deleteById(id);
    }
}
